package com.ncmmall.domain.business.distribution;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ncmmall.domain.security.user.WebUser;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * 分销商
 */
@Entity
@Table(name = "distributor")
@Access(AccessType.FIELD)
@Getter
@Setter
@Accessors(chain = true)
@EqualsAndHashCode
@ToString
public class Distributor {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 用户
     */
    @OneToOne
    private WebUser user;

    /**
     * 账户余额
     */
    private double balance;

    /**
     * 分销商等级
     */
    @OneToOne
    private DistributorLevel level;

    /**
     * 是否开启微店
     */
    private Boolean microShop;

    /**
     * 店铺名称
     */
    private String shopName;

    /**
     * 店铺背景图片
     */
    private String shopBackgroundImage;

    /**
     * 经销商来源
     * 1、推广
     * 2、手工添加(总后台添加)
     * 3、自己申请
     */
    private Integer source;

    /**
     * 账号状态
     * 1、正常
     * 2、禁用
     */
    private Integer accountStatus;

    /**
     * 创建时间
     */
    private Timestamp createTime;

    @Transient
    @JsonIgnore
    private String userIds;

    /**
     * 商家选择展示的商品的三级分类
     */
    private String channelIds;

}
